package com.test.pudamoney.activity_fragment_pudamoney.base_pudamoney;

import android.text.TextUtils;

import androidx.fragment.app.Fragment;

import com.test.pudamoney.util_pudamoney.http_pudamoney.HttpManager_pudamoney;

public class BaseFragment_pudamoney extends Fragment {

    protected String pageTag_pudamoney;

    @Override
    public void onResume() {
        super.onResume();
        recordPageResumeEvent_pudamoney();
    }

    @Override
    public void onPause() {
        super.onPause();
        recordPagePauseEvent_pudamoney();
    }


    //页面埋点
    private void recordPagePauseEvent_pudamoney() {
        //保存埋点
        String fragmentName = getClass().getSimpleName();
        if (!TextUtils.isEmpty(pageTag_pudamoney)) fragmentName = pageTag_pudamoney;
        if (!TextUtils.isEmpty(fragmentName)) {
            HttpManager_pudamoney.getInstance().saveUserBuriedPoint((fragmentName + "_END").toUpperCase());
        }
    }

    //页面埋点
    private void recordPageResumeEvent_pudamoney() {
        //保存埋点
        String fragmentName = getClass().getSimpleName();
        if (!TextUtils.isEmpty(pageTag_pudamoney)) fragmentName = pageTag_pudamoney;
        if (!TextUtils.isEmpty(fragmentName)) {
            HttpManager_pudamoney.getInstance().saveUserBuriedPoint((fragmentName + "_START").toUpperCase());
        }
    }

}
